package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.shopping.converter.ProductCateConverter;
import com.cskaoyan.shopping.dal.entitys.ItemCat;
import com.cskaoyan.shopping.dal.persistence.ItemCatMapper;
import com.cskaoyan.shopping.dto.ProductCateDto;
import com.cskaoyan.shopping.service.IProductCateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * \* User: 余雨健
 * \* Date: 2022/10/25
 * \* Time: 21:46
 **/
@Service
public class IProductCateServiceImpl implements IProductCateService {

    @Autowired
    ItemCatMapper itemCatMapper;
    @Autowired
    ProductCateConverter productCateConverter;

    /**
     *@
     *@author yuyujian
     *@Date 2022/10/26
     *@Time 17:39
     */
    @Override
    public List<ProductCateDto> getAllProductCate(String sort) {
        //获取所有商品类目
        List<ItemCat> itemCats = itemCatMapper.selectAllItemCat();
        List<ProductCateDto> productCateDtos = productCateConverter.items2Dto(itemCats);
        return productCateDtos;
    }
}
